Modularly Typesafe Interface Dispatch in JPred
نویسندگان
چکیده
Multiple dispatch generalizes the receiver-oriented dynamic dispatch of traditional object-oriented (OO) languages by allowing the run-time classes of all arguments to be employed. While research over the last decade has shown how to integrate multiple dispatch with the modular static typechecking found in traditional OO languages, that work has been forced to impose unnatural restrictions or modifications in order to safely accommodate multiple inheritance. In the context of Java, the effect has been to make it difficult to dispatch on interfaces. In this paper, we illustrate how the concept of predicate dispatch, which generalizes multiple dispatch by allowing each method to be guarded by a predicate indicating when the method should be invoked, provides a simple but practical way to support dispatch on interfaces while preserving modular typechecking. We have instantiated our approach in the context of JPred, an existing extension to Java supporting predicate dispatch that previously disallowed dispatch on interfaces altogether. We have formalized our approach in a core subset of JPred and proven an associated type soundness theorem. We have also performed two case studies using JPred, on the JPred compiler itself and on portions of Eclipse, to demonstrate the utility of our approach in practice.
منابع مشابه
MultiJava: Modular Symmetric Multiple Dispatch and Extensible Classes for Java
Multiple dispatch offers several well-known advantages over the single dispatching of conventional object-oriented languages, including a simple solution to the “binary method” problem and cleaner implementations of the “strategy” and similar design patterns. Extensible classes allow one to extend the set of methods that an existing class supports without editing that class or client code. This...
متن کاملThe Jpred 3 secondary structure prediction server
Jpred (http://www.compbio.dundee.ac.uk/jpred) is a secondary structure prediction server powered by the Jnet algorithm. Jpred performs over 1000 predictions per week for users in more than 50 countries. The recently updated Jnet algorithm provides a three-state (alpha-helix, beta-strand and coil) prediction of secondary structure at an accuracy of 81.5%. Given either a single protein sequence o...
متن کاملJava-COM integration with JACOB using XML wrappers
ManyWindows-based legacy applications can be programmatically accessed using COM interfaces. However, calling COM components from Java is not straightforward. This report compares four open source Java-COM integration packages. A technique for typesafe Java-COM integration is presented. The technique is based on typesafe COM interface wrappers using jcom, java2com and JACOB libraries. Examples ...
متن کاملFine-Grained Function Visibility for Multiple Dispatch with Multiple Inheritance
Object-oriented languages with multiple dispatch and multiple inheritance provide rich expressiveness but statically and modularly checking programs in such languages to guarantee that no ambiguous calls can occur at run time has been a difficult problem. We present a core calculus for Fortress, which provides various language features—notably functional methods and components— and solves the p...
متن کاملAn Extensible Protocol Architecture for Application-speciic Networking
Plexus is a networking architecture that allows applications to achieve high performance with customized protocols. Application-speciic protocols are written in a typesafe language and installed dynamically into the operating system kernel. Because these protocols execute within the kernel, they can access the network interface and other operating system services with low overhead. Protocols im...
متن کامل